package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class RegistrarIngredientes extends javax.swing.JFrame {
	private JPanel panIngredientes;
	private JButton btnLimpiar;
	private JLabel lblNroCod;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JLabel jLabel4;
	private JLabel jLabel5;
	private JButton btnVer;
	private JButton btnSalir;
	private JButton btnEliminaringre;
	private JButton btnModifingr;
	private JButton btnIncluirInge;
	private JTextField txtCantingr;
	private JLabel jLabel8;
	private JSeparator jSeparator2;
	private JComboBox cmbUnidadMedIng;
	private JLabel jLabel7;
	private JTextField txtStockMaxIng;
	private JTextField txtStockMinIngr;
	private JLabel jLabel6;
	private JTextField txtExistenciaIngre;
	private JTextField txtNombingr;
	private JSeparator jSeparator1;
	private JButton btnBuscarIngrediente;
	private JLabel jLabel1;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public RegistrarIngredientes() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setBackground(new java.awt.Color(0,0,0));
			getContentPane().setLayout(null);
			{
				panIngredientes = new JPanel();
				getContentPane().add(panIngredientes, "Center");
				panIngredientes.setLayout(null);
				panIngredientes.setBounds(32, 88, 433, 280);
				panIngredientes.setBackground(new java.awt.Color(150,182,35));
				panIngredientes.setLayout(null);
				{
					jLabel2 = new JLabel();
					panIngredientes.add(jLabel2);
					jLabel2.setText("Código:");
					jLabel2.setBounds(12, 8, 66, 18);
					jLabel2.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					btnBuscarIngrediente = new JButton();
					panIngredientes.add(btnBuscarIngrediente);
					btnBuscarIngrediente.setText("Buscar");
					btnBuscarIngrediente.setBounds(157, 7, 88, 21);
					btnBuscarIngrediente.setBackground(new java.awt.Color(255,255,255));
					btnBuscarIngrediente.setFont(new java.awt.Font("Purisa",0,14));
					btnBuscarIngrediente.setActionCommand("Buscar");
				}
				{
					jSeparator1 = new JSeparator();
					panIngredientes.add(jSeparator1);
					jSeparator1.setBounds(9, 34, 382, 14);
				}
				{
					jLabel3 = new JLabel();
					panIngredientes.add(jLabel3);
					jLabel3.setText("Nombre:");
					jLabel3.setBounds(82, 60, 75, 14);
					jLabel3.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtNombingr = new JTextField();
					panIngredientes.add(txtNombingr);
					txtNombingr.setBounds(157, 56, 163, 21);
					KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.valueOf(' '), 0);
					this.txtNombingr.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, "none");
				}
				{
					jLabel4 = new JLabel();
					panIngredientes.add(jLabel4);
					jLabel4.setText("Existencia:");
					jLabel4.setBounds(77, 142, 92, 14);
					jLabel4.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtExistenciaIngre = new JTextField();
					panIngredientes.add(txtExistenciaIngre);
					txtExistenciaIngre.setBounds(160, 138, 98, 21);
					txtExistenciaIngre.setEnabled(false);
				}
				{
					jLabel5 = new JLabel();
					panIngredientes.add(jLabel5);
					jLabel5.setText("Stock Mínimo:");
					jLabel5.setBounds(47, 206, 108, 14);
					jLabel5.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					jLabel6 = new JLabel();
					panIngredientes.add(jLabel6);
					jLabel6.setText("Stock Máximo:");
					jLabel6.setBounds(47, 233, 116, 14);
					jLabel6.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtStockMinIngr = new JTextField();
					panIngredientes.add(txtStockMinIngr);
					txtStockMinIngr.setBounds(161, 202, 70, 21);
				}
				{
					txtStockMaxIng = new JTextField();
					panIngredientes.add(txtStockMaxIng);
					txtStockMaxIng.setBounds(162, 229, 68, 21);
				}
				{
					jLabel7 = new JLabel();
					panIngredientes.add(jLabel7);
					jLabel7.setText("Unidad de Medida:");
					jLabel7.setBounds(6, 86, 154, 14);
					jLabel7.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					cmbUnidadMedIng = new JComboBox();
					panIngredientes.add(cmbUnidadMedIng);
					cmbUnidadMedIng.setBounds(157, 82, 163, 21);
				}
				{
					jSeparator2 = new JSeparator();
					panIngredientes.add(jSeparator2);
					jSeparator2.setBounds(9, 123, 311, 10);
				}
				{
					jLabel8 = new JLabel();
					panIngredientes.add(jLabel8);
					jLabel8.setText("Cantidad Entrante:");
					jLabel8.setBounds(4, 173, 150, 14);
					jLabel8.setFont(new java.awt.Font("Purisa",0,14));
				}
				{
					txtCantingr = new JTextField();
					panIngredientes.add(txtCantingr);
					txtCantingr.setBounds(160, 169, 96, 21);
				}
				{
					btnIncluirInge = new JButton();
					panIngredientes.add(btnIncluirInge);
					btnIncluirInge.setBounds(350, 54, 54, 39);
					btnIncluirInge.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnIncluirInge.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/incluirblack.jpg")));
					btnIncluirInge.setOpaque(false);
					btnIncluirInge.setBackground(new java.awt.Color(150,182,35));
					btnIncluirInge.setActionCommand("Incluir");				
				}
				{
					btnModifingr = new JButton();
					panIngredientes.add(btnModifingr);
					btnModifingr.setBounds(351, 103, 53, 40);
					btnModifingr.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnModifingr.setOpaque(false);
					btnModifingr.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/modificargrren.jpg")));
					btnModifingr.setBackground(new java.awt.Color(150,182,35));
					btnModifingr.setActionCommand("Modificar");
				}
				{
					btnEliminaringre = new JButton();
					panIngredientes.add(btnEliminaringre);
					btnEliminaringre.setBounds(351, 149, 53, 45);
					btnEliminaringre.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnEliminaringre.setOpaque(false);
					btnEliminaringre.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/Eliminar.jpg")));
					btnEliminaringre.setBackground(new java.awt.Color(150,182,35));
					btnEliminaringre.setActionCommand("Eliminar");
				}
				{
					btnSalir = new JButton();
					panIngredientes.add(btnSalir);
					btnSalir.setBounds(351, 206, 53, 45);
					btnSalir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/salir.jpg")));
					btnSalir.setOpaque(false);
					btnSalir.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					btnSalir.setActionCommand("Salir");
				}
				{
					btnVer = new JButton();
					panIngredientes.add(btnVer);
					btnVer.setText("Ver");
					btnVer.setFont(new java.awt.Font("Purisa",0,14));
					btnVer.setBackground(new java.awt.Color(255,255,255));
					btnVer.setBounds(256, 7, 53, 21);
					btnVer.setActionCommand("Ver");
				}
				{
					btnLimpiar = new JButton();
					panIngredientes.add(btnLimpiar);
					btnLimpiar.setActionCommand("Limpiar");
					btnLimpiar.setBackground(new java.awt.Color(150,182,35));
					btnLimpiar.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
					btnLimpiar.setBounds(314, 5, 50, 23);
					btnLimpiar.setText("Nuevo");
					
				}
				{
					lblNroCod = new JLabel();
					panIngredientes.add(lblNroCod);
					lblNroCod.setFont(new java.awt.Font("Purisa",0,14));
					lblNroCod.setBounds(75, 8, 51, 18);
				}
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Ingredientes");
				jLabel1.setBounds(139, 12, 273, 80);
				jLabel1.setForeground(new java.awt.Color(255,255,255));
				jLabel1.setFont(new java.awt.Font("Purisa",1,24));
				jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/IngredientesBlack.jpg")));
			}
			pack();
			this.setSize(496, 416);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	public void addListener(ActionListener actionListener) {
		this.btnBuscarIngrediente.addActionListener(actionListener);
		this.btnIncluirInge.addActionListener(actionListener);
		this.btnModifingr.addActionListener(actionListener);
		this.btnEliminaringre.addActionListener(actionListener);
		this.btnSalir.addActionListener(actionListener);
		this.btnVer.addActionListener(actionListener);
		this.btnLimpiar.addActionListener(actionListener);
	}
	
	public void setUnidadMedicion(String[] unidadMedicion) {
		ComboBoxModel cmbUnidadMedicionModel = new DefaultComboBoxModel(unidadMedicion);
		this.cmbUnidadMedIng.setModel(cmbUnidadMedicionModel);
	}
	
	public String getUnidadMedicion(){
		return this.cmbUnidadMedIng.getSelectedItem().toString();
	}
	
	public void setTxtExistencia(String existencia){
		this.txtExistenciaIngre.setText(existencia);
	}
	
	public String getTxtExistencia(){
		return this.txtExistenciaIngre.getText();
	}
	
	public String getCantEntrante(){
		return this.txtCantingr.getText();
	}
	
	public void setCantEntrante(String cant){
		this.txtCantingr.setText(cant);
	}
	
	public void setNroCodigo(String c){
		this.lblNroCod.setText(c);
	}
	
	public String getNroCodigo(){
		return this.lblNroCod.getText();
	}
	
	public void setTxtNombre(String n)	{
		this.txtNombingr.setText(n);
	}
	
	public String getTxtNombre(){
		return this.txtNombingr.getText();
	}
	
	public void setTxtStockMin(String smin){
		this.txtStockMinIngr.setText(smin);
	}
	
	public String getTxtStockMin(){
		return this.txtStockMinIngr.getText();
	}
	
	public void setTxtStockMax(String smax){
		this.txtStockMaxIng.setText(smax);
	}
	
	public String getStockMax(){
		return this.txtStockMaxIng.getText();
	}
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
}
